package com.wl.zlmanage.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by Kanghao on 2018/7/2.
 */
public class StringUtil {
    public static String subString(String str,int index, String strEnd) {

        /* 找出指定的2个字符在 该字符串里面的 位置 */
        int strStartIndex ;
        Matcher slashMatcher = Pattern.compile("/").matcher(str);
        int mIdx = 0;
        while (slashMatcher.find()) {
            mIdx++;
            if (mIdx == index) {
                break;
            }
        }
        strStartIndex = slashMatcher.start();

        int strEndIndex = str.indexOf(strEnd);

        String result = str.substring(strStartIndex+1, strEndIndex);

        return result;
    }
}
